﻿using System;
using System.IO;
using System.Windows;

namespace WpfTraceSolution
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }


        private void btnWriteWithMethod_Click(object sender, RoutedEventArgs e)
        {
            LogHelper.WriteWithMethod("Do Write With method");
        }

        private void btnWriteWithFileInfo_Click(object sender, RoutedEventArgs e)
        {
            LogHelper.WriteWithFileInfo("Do Write With fileInfo");
        }

        private void btnWriteWithTimeInfo_Click(object sender, RoutedEventArgs e)
        {
            LogHelper.WriteWithTime("Do Write With Time");
        }

        private void btnWriteWithDateTime_Click(object sender, RoutedEventArgs e)
        {
            LogHelper.WriteWithDateTime("Do Write With DateTime");
        }

        private void btnWriteError_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                File.AppendAllText("log\a.txt", "Do ");
            }
            catch (Exception ex)
            {
                // LogHelper.WriteException(ex, "create file Fail");
                LogHelper.WriteWithMethod("create file fail");
            }
        }

        private void btnWriteObject_Click(object sender, RoutedEventArgs e)
        {
            string tt = "MY";
            LogHelper.WriteObject(() => tt);
            //string t = LogHelper.ExampleFunction(() => tt);
            //Trace.WriteLine(t);
        }
    }
}
